/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.tomasio.projects.welcome.model;

import com.tomasio.projects.welcome.dto.ChaveDTO;



/**
 *
 * @author Install
 */
public class Chave {

    private Long id;
    private String descricao;
    private int numero;

    public Chave() {
    }
    public Chave(ChaveDTO dto) {
        if (dto != null){
            this.id = dto.getId();
            this.descricao = dto.getDescricao();
            this.numero = dto.getNumero();
        }
    }


    public String getDescricao() {
        return descricao;
    }

    public void setDescricao(String descricao) {
        this.descricao = descricao;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public int getNumero() {
        return numero;
    }

    public void setNumero(int numero) {
        this.numero = numero;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (getId() != null ? getId().hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Chave)) {
            return false;
        }
        Chave other = (Chave) object;
        if ((this.getId() == null && other.getId() != null) || (this.getId() != null && !this.getId().equals(other.getId()))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Chave[id=" + getId() + "]";
    }
     public ChaveDTO createDTO() {
        ChaveDTO dto = new ChaveDTO();
        dto.setDescricao(descricao);
        dto.setId(id);
        dto.setNumero(numero);
        return dto;
    }
}
